#ifndef APPLICATION_H_

#define _WIN32_WINNT  0x0401

#include <stdio.h>
#include <stdlib.h>
#include <vector>

#include "OpenGL\GLee.h"
//#include <windows.h>
#include <commctrl.h>


//#include <GL\GL.h>
#include <GL\GLU.h>
#include <GL\GLAux.h>
#include "OpenGL\colors.h"
#include "Math\mtxlib.h"

namespace BaseWindow {

    class Application 
    {
    private:
        matrix44 _sceneViewRotation;
        matrix44 _sceneViewTranslation;
        matrix44 _modelViewRotate;
        matrix44 _modelViewTranslate;
        matrix44 _modelOrientation;
        matrix44 _scenePerspective;
        /***********************
        * SEKCJA zmiennych i metod wlasciwych dla programu
        ************************/
        GLuint    _vS, _fS, _prog;

        double    _dx, _dy, _dz;
        double    _y, _p, _r;  //katy yaw, pitch, roll
        double    _timeStep;

        /***********************/

    protected:
        HINSTANCE   _hInst;
        HWND        _hWnd;
        HDC           _hDC;
        HGLRC       _hRC;
        RECT          _wndRect;
        bool        _fullscreen;
        unsigned int _width, _height;
        POINT    _mousePos;
        
        DWORD       GetWindowStyle();
        void        GetLastWindowError();
        bool        SetUpPixelFormat( HDC hdc );
        void        SizeOpenGLScreen( int width, int height );
        bool        InitializeOpenGL(int width, int height);
        void        InitializeLight();
        void        Deinitialize();
        void        OnMouseMove( WPARAM wParam, LPARAM lParam );
        void        OnMouseWheel( WPARAM wParam, LPARAM lParam );
        void        OnKeyDown( WPARAM wParam, LPARAM lParam );
        void        InitializeLittleTop();

        void        SetShaders();
        void        DelShaders();
        char*      GetTextFromFile(char* name);

        /**********************************
        * Metody Menu
        **********************************/
  
    public:
        Application(HINSTANCE hInstance);
        ~Application();
        /***********************************
        * RYSOWANIE ROZNYCH ELEMENTOW
        ************************************        

        /***********************************
        * STANDARDOWE METODY
        ***********************************/
        void        Update();
        void        Draw();
        void        Release();
        void        Exit();
        bool        Init();
        int         CreateWndClass(HICON icon);
        int         CreateWnd();
        int         Run();
        int         Go(HICON hicon);

        static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
        LRESULT OnWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
    };
}

#endif